From: Florian Müllner Date: Tue, 17 Dec 2019 19:06:24 +0000 (+0100) Subject: sessionMode: Use property spread to sync mode X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~1^2~152 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d6651706fe4c8d5a059162f958ef4745fbb0a3b8;p=gnome-shell.git sessionMode: Use property spread to sync mode The parameters here come from a fixed set of mode definitions rather than a function parameter, so the additional check performed by Params.parse() isn't relevant here. Part-of: --- diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js index 8e30a665c..9c80532b6 100644 --- a/js/ui/sessionMode.js +++ b/js/ui/sessionMode.js @@ -4,7 +4,6 @@ import GLib from 'gi://GLib'; import * as Signals from '../misc/signals.js'; import * as FileUtils from '../misc/fileUtils.js'; -import * as Params from '../misc/params.js'; import {LoginDialog} from '../gdm/loginDialog.js'; import {UnlockDialog} from '../ui/unlockDialog.js'; @@ -191,16 +190,12 @@ export class SessionMode extends Signals.EventEmitter { } _sync() { - let params = _modes[this.currentMode]; - let defaults; - if (params.parentMode) { - defaults = Params.parse( - _modes[params.parentMode], - _modes[DEFAULT_MODE]); - } else { - defaults = _modes[DEFAULT_MODE]; - } - params = Params.parse(params, defaults); + const current = _modes[this.currentMode]; + const parent = current.parentMode + ? {..._modes[DEFAULT_MODE], ..._modes[current.parentMode]} + : {..._modes[DEFAULT_MODE]}; + + const params = {...parent, ...current}; // A simplified version of Lang.copyProperties, handles // undefined as a special case for "no change / inherit from previous mode"